﻿@{
    Layout = null;
    var lst = ViewData["lstmes"] as List<SmallJob.Model.MConversation>;
    var user = ViewData["owner"] as SmallJob.Model.User;
    var userid = (int)ViewData["curuserid"];
}
<div class="wrapper-conversations">
    @foreach (var item in lst)
    {
        var isop = item.Type == (int)SmallShop.Services.Implements.MessageType.ORDER_PROVIDE;
        var isor = item.Type == (int)SmallShop.Services.Implements.MessageType.ORDER_REQUEST;
         var client = (user.ID==item.Person1ID?item.User2:item.User1);
         var asworker = SmallShop.Services.Code.OrderHelper.TestIsWorker(item, user.ID);
        <a class="conversation-item" id="Cvs-@item.ShortID" onclick="loadCvs(this);" href="#">
            <input type="hidden" class="hidden-cvs-order-type"  value="@(asworker ? 1 : 0)" />
            <div class="conversation-item-inner">
                <div class="sender-avatar pull-left" title="Thăm trang cá nhân người này.">
                    <img src="@(string.IsNullOrWhiteSpace(client.Avatar) ? Url.Content("~/Content/img/blank-avatar.jpg") : client.Avatar)?w=64&h=64&q=90&format=jpg&mode=crop" />
                </div>
                <div class="inbox-body">
                    <p class="inbox-meta">
                        <span class="inbox-sender">@(client.Name)</span>
                    </p>
                    <p class="inbox-title">
                        @(isor ? item.Order.Request.Title : item.Order.Provide.Title)
                    </p>
                </div>
            </div>
        </a>
    }
</div>
@if (ViewData["nextpage"] != null)
{
    <a data-nextpage="@ViewData["nextpage"]" id="new-next-page"></a>
}